Properties of Test Run Attributes after "Create Test Run.."

Hello Dxl Community,

I have a piece of code that disables color changes on certain Test Attributes if they are edited.

void UnbarAttributes(void)
{
        Module m = current 
        Object o

        string objAttrName 
        for objAttrName in (m) do 
        {
                if (matches("Actual Test Result",objAttrName))
                {     
                
                        AttrDef ad=find( m, objAttrName)
                        ad = modify(ad, setBars, false);
                        print objAttrName "\n" 
                }.......

OK, nothing strange and startling here. The problem is when I generate new Test Attributes as a result of creating a Test Run, I have to remember to apply the above script again to the current module after a test run. I would like to integrate the two steps into one. That is, every time a new  "Test Run" is created the generated attributes with the setBar  "FALSE" argument. It should be as if the operator "modify(ad, setBars, false)" was applied to it.

In other words, I want to keep the change bar blue if I comment on a baselined Test Run.

I tried modifying C:\Program Files (x86)\IBM\Rational\DOORS\9.5\lib\dxl\standard\testtracking\t3_creatRun.dxl as follows:

#include <standard/testTracking/t3_createRun.inc>

print "Test Stub"

 

However I dont get to see the print statement so any setBar() functions placed here wont work.

Anyone know a better way?

regards

Colm

 


MyDeveloerWorks - Mon Apr 28 09:27:41 EDT 2014

Re: Properties of Test Run Attributes after "Create Test Run.."
llandale - Tue Apr 29 12:27:04 EDT 2014

Don't know.  I think you could just run a nightly script that changes the properties of that attribute

But there is something strange and startling about your code.

  • "matches" is particularly ineffecient; it actually creates a Reqexp allocated unit and doesn't release it.  Instead this will work:
    • if (objAttrName == "Actual Test Result")
  • Forget the loop.  You don't need to loop looking for a name you already know about:
    • AttrDef ad=find( m, "Actual Test Result")
      if (!null ad  and ad.bars) then   ad = modify(ad, setBars, false);

-Louie

Re: Properties of Test Run Attributes after "Create Test Run.."
Adamarla - Wed Apr 30 02:24:02 EDT 2014

Maybe this works... Didn't try it:

AttrDef Original_modify(AttrDef oAttrDef, ADMABool_ oADMABool, bool bSetting) {
    return modify(oAttrDef, oADMABool, bSetting)
}

AttrDef modify(AttrDef oAttrDef, ADMABool_ oADMABool, bool bSetting) {
        oAttrDef = Original_modify(oAttrDef, oADMABool, bSetting)
        return Original_modify(oAttrDef, setBars(), true)
}

#include <standard/testTracking/t3_createRun.inc>

Edited to run Original_modify in modify function

Re: Properties of Test Run Attributes after "Create Test Run.."
MyDeveloerWorks - Wed May 07 08:59:48 EDT 2014

llandale - Tue Apr 29 12:27:04 EDT 2014

Don't know.  I think you could just run a nightly script that changes the properties of that attribute

But there is something strange and startling about your code.

  • "matches" is particularly ineffecient; it actually creates a Reqexp allocated unit and doesn't release it.  Instead this will work:
    • if (objAttrName == "Actual Test Result")
  • Forget the loop.  You don't need to loop looking for a name you already know about:
    • AttrDef ad=find( m, "Actual Test Result")
      if (!null ad  and ad.bars) then   ad = modify(ad, setBars, false);

-Louie

Hello Louie,

 

Thanks for the tip. I have replaced the line with "matches" with the following

int len_of_attr= length(objAttrName)
if (objAttrName[0:len_of_attr-1]=="Actual Test Result")
{
    AttrDef ad=find( m, objAttrName)
    if (!null ad  and ad.bars)
        ad = modify(ad, setBars, false);)

}

I have to check for a the first "Length-1" characters in order to see if there is a match so I can identify attributes

as follows:

Actual Test Result T1
Actual Test Result T2
Actual Test Result T3

 

Colm

Re: Properties of Test Run Attributes after "Create Test Run.."
MyDeveloerWorks - Wed May 07 09:07:24 EDT 2014

Adamarla - Wed Apr 30 02:24:02 EDT 2014

Maybe this works... Didn't try it:

AttrDef Original_modify(AttrDef oAttrDef, ADMABool_ oADMABool, bool bSetting) {
    return modify(oAttrDef, oADMABool, bSetting)
}

AttrDef modify(AttrDef oAttrDef, ADMABool_ oADMABool, bool bSetting) {
        oAttrDef = Original_modify(oAttrDef, oADMABool, bSetting)
        return Original_modify(oAttrDef, setBars(), true)
}

#include <standard/testTracking/t3_createRun.inc>

Edited to run Original_modify in modify function

That looks like an endless recursive loop to me. Are you  trying to redefine how the modify() method works prior to a test run? 

At what point to the newly created attributes as a result of the Test Run (i.e.Actual Test Result T1,

Actual Test Result T2, Actual Test Result T3, etc) get modified so with the following call :

ad = modify(ad, setBars, false);?

regards

Colm

Re: Properties of Test Run Attributes after "Create Test Run.."
Adamarla - Wed May 07 10:25:37 EDT 2014

MyDeveloerWorks - Wed May 07 09:07:24 EDT 2014

That looks like an endless recursive loop to me. Are you  trying to redefine how the modify() method works prior to a test run? 

At what point to the newly created attributes as a result of the Test Run (i.e.Actual Test Result T1,

Actual Test Result T2, Actual Test Result T3, etc) get modified so with the following call :

ad = modify(ad, setBars, false);?

regards

Colm

I edited the code to call Original_modify() in the modify() function.

It shoud repurpose all subsequent modify() calls to set setBars to true in addition to whatever it was going to do.

<Still untested - maybe you want it set to false>

Re: Properties of Test Run Attributes after "Create Test Run.."
llandale - Wed May 07 11:41:43 EDT 2014

MyDeveloerWorks - Wed May 07 08:59:48 EDT 2014

Hello Louie,

 

Thanks for the tip. I have replaced the line with "matches" with the following

int len_of_attr= length(objAttrName)
if (objAttrName[0:len_of_attr-1]=="Actual Test Result")
{
    AttrDef ad=find( m, objAttrName)
    if (!null ad  and ad.bars)
        ad = modify(ad, setBars, false);)

}

I have to check for a the first "Length-1" characters in order to see if there is a match so I can identify attributes

as follows:

Actual Test Result T1
Actual Test Result T2
Actual Test Result T3

 

Colm

OK, so I guess you do need the loop...

Makes little difference, but I have a preferance for this loop:

  • for ad in mod do
  • {  if (!ad.object)       then continue   // Attr doesn't apply to Objects 
  •    NameAD = ad.name
  •    ...
  • }